#encoding=utf-8
#!/usr/bin/python


import os, sys, string,time,datetime
import mod_adm

import cgi
import wsgiref.handlers
from google.appengine.ext import webapp
from google.appengine.ext.webapp import template


class MainPage(webapp.RequestHandler):
    def get(self):
        "默认页面"
        self.response.out.write('hello')#显示
    
class http_get(webapp.RequestHandler):  
    def get(self):
        page_str = ''

        http_get = mod_adm.snatch() #初始化
        page_str += http_get.test('http://www.abans.cn/') #获取
        self.response.out.write(page_str)#显示

    def post(self):
        self.get()

class list_dir(webapp.RequestHandler):
    def post(self):
        self.get()

    def get(self):
        page_str = ''
        page_str +=  "%s" % os.path
        
        list_obj = mod_adm.list_dir()#初始化
        page_str += "%s" % list_obj.test(os.path.dirname(__file__))
        
        


        self.response.out.write(page_str)

def main():
    #路由
    application = webapp.WSGIApplication([
    ('/adm_gae', MainPage),
    ('/adm_gae/http_get', http_get),
    ('/adm_gae/list_dir', list_dir),
    ('/adm_gae/.*', MainPage),
    ],
    debug=True)
                                       
    wsgiref.handlers.CGIHandler().run(application)

if __name__ == "__main__" :
    main()  






